package com.sand.entity;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "collection", schema = "ssh_pro", catalog = "")
public class CollectionEntity {
    /**
     * @author <achao1441470436@gmail.com>
     * @since 2021/11/28/028 14:46
     */
    private int rid;
    private int userId;
    private int houseId;

    @Id
    @Column(name = "rid")
    public int getRid() {
        return rid;
    }

    public void setRid(int rid) {
        this.rid = rid;
    }

    @Basic
    @Column(name = "userId")
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "houseId")
    public int getHouseId() {
        return houseId;
    }

    public void setHouseId(int houseId) {
        this.houseId = houseId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CollectionEntity that = (CollectionEntity) o;
        return rid == that.rid && userId == that.userId && houseId == that.houseId;
    }

    @Override
    public String toString() {
        return "CollectionEntity{" +
                "rid=" + rid +
                ", userId=" + userId +
                ", houseId=" + houseId +
                '}';
    }

    @Override
    public int hashCode() {
        return Objects.hash(rid, userId, houseId);
    }
}
